home *** CD-ROM | disk | FTP | other *** search
- /*[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]*/
- /* UGridView.p */
- /* Copyright © 1987-1990 by Apple Computer Inc. All rights reserved. */
- #ifndef __UGridView__
- #define __UGridView__ 0
- #endif
- #if ! __UGridView__
- #define __UGridView__ 1
-
- /* • Auto-Include the requirements for this unit's interface. */
- #ifndef __UMacApp__
- #include "UMacApp.h"
- #endif
-
- /* Booleans for Adornment */
- const short kAdorn = true;
- const short kDontAdorn = false;
-
- /* Booleans for SetSelection */
- const short kExtend = true;
- const short kDontExtend = false;
-
- const short kHighlight = true;
- const short kDontHighlight = false;
-
- const short kSelect = true;
- const short kDeSelect = false;
-
- typedef Point GridCell; /* A cell is a QuickDraw point */
-
- typedef enum {badChoice, inCell, inRow, inColumn, inVertex} GridViewPart;
-
- /*--------------------------------------------------------------------------------------
- ------------*/
-
- struct RunArrayChunk {
- short count; /* Number of consecutive items with this
- value */
- short value; /* The value represented by this chunk */
- };
-
- typedef RunArrayChunk ChunkArray[100001];
- typedef ChunkArray *ChunkArrayPtr; /* Preferred */
- typedef ChunkArrayPtr *ChunkArrayHandle; /* Preferred */
- typedef ChunkArrayPtr PChunkArray; /* Left in for compatibility (2.0) */
- typedef ChunkArrayHandle HChunkArray; /* Left in for compatibility (2.0) */
-
- class TRunArray : public TObject {
- public: /* The run array class is used to maintain
- the column widths and row heights. Entries
- in the array are values for a given item,
-
- where the items are indexed from one.
- fNoOfItems indicates the number of items
- (and values) in the array. The values are
- maintained in "chunks" which lump together
- consecutive items with the same value. A
- variable length array, fChunks,
- is used to
- store the chunks. It is indexed from zero.
- */
- short fLastItem; /* cache the last item found */
- short fLastChunk; /* cache the last chunk found */
-
- long fLastTotal; /* cache the last total calculated */
- short fLastIndex; /* cache the last index used */
- short fNoOfItems;
- /* Number of items (values) in this run-array
- */
- long fTotal; /* The sum of the values in the run array */
- short fNoOfChunks; /* Number of chunks in the run array */
- ChunkArrayHandle fChunks; /* A handle to the chunks themselves. */
-
- virtual pascal void IRunArray(void);
- /* Initializes a run array to have zero items. */
-
- virtual pascal void Free(void);
- /* Frees the fChunks field which is a handle to the chunks, before calling inherited
- Free. */
-
- virtual pascal void InsertItems(short firstItem, short noOfItems, short value);
-
- /* Inserts the indicated items into the run array, all of which have the given value.
- */
-
- virtual pascal void DeleteItems(short firstItem, short noOfItems);
- /* Deletes the indicated items from the run array.*/
-
- virtual pascal Boolean FindChunk(short item, short *chunk, short *indexInChunk, long *theTotal);
-
- /* Returns information about a given item in the run array. chunk indicates the chunk
- in which the item is located, where zero is the first chunk in the run array.
- indexInChunk is the location of the item withinin the chunk. Note that the chunk
- indexes are one-based--the first item in the chunk is index 1. theTotal is the sum
- of values up to, but not including, the chunk in which the given item is located.
- FindChunk returns false if the given item is outside the range of items in the
- run-array (i.e. item < 1 or item > fNoOfItems), or the given item is not
- represented in a chunk (i.e. a bug).
- Example: Item Value Chunk indexInChunk theTotal
- 1 05 0 1 000
- 2 05 0 2 000
- 3 20 1 1 010
- 4 35 2 1 030
- 5 35 2 2 030
- 6 10 3 1 100
- */
-
- virtual pascal short FindItem(long theTotal);
- /* Returns the item number for which the sum of the values exceeds theTotal, or zero
- if theTotal is outside the sum of values represented by the run array.*/
-
- virtual pascal short GetValue(short item);
- /* Returns the value for the given item. */
-
- virtual pascal long SumValues(short firstItem, short noOfItems);
- /* Returns the sum of the values over the given items. */
-
- virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short
- fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
- /* Used by the Inspector and the Debugger to display the contents of this class's
- fields. */
-
- };
-
- /*--------------------------------------------------------------------------------------
- ------------*/
-
- struct GridViewTemplate {
- short numOfRows;
- short numOfCols;
- short rowHeight;
- short colWidth;
- short rowInset;
- short colInset;
- unsigned adornRows : 1;
- unsigned adornCols : 1;
- unsigned singleSelection : 1;
- unsigned filler : 13;
- };
- typedef GridViewTemplate *GridViewTemplatePtr;
-
- struct TextGridViewTemplate {
- Style itsFontFace;
- short itsFontSize;
- RGBColor itsFontColor;
- Str255 itsFontName; /* a variable length P-String */
- };
- typedef TextGridViewTemplate *TextGridViewTemplatePtr;
-
- class TGridView : public TView {
- public: /* TGridView forms the base class for a
- building block that allows the creation of
- views that can contain and manage cells,
-
- similar to a spreadsheet. */
- short fNumOfRows; /* number of rows */
- short fNumOfCols; /* number of columns */
- TRunArray *fColWidths; /* bag containing col widths */
- TRunArray *fRowHeights; /* bag containing row heights */
- Boolean fAdornRows; /* Draw adornment for rows? */
- Boolean fAdornCols; /* Draw adornment for columns? */
- short fRowInset; /* Number of pixels between cell rows */
- short fColInset; /* Number of pixels between cell cols */
- Boolean fSingleSelection; /* only one cell selected at a time? */
- RgnHandle fSelections; /* Region of currently selected cells */
- RgnHandle fHLRegion; /* Region of cells to be highlighted. This
- will be different from fSelections while
- selection with the mouse is taking place.
- */
- RgnHandle fTempSelections; /* Used by SetSelectionRect */
-
- virtual pascal void IGridView(TDocument *itsDocument, TView *itsSuperView, VPoint *itsLocation,
- VPoint *itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, short numOfRows,
- short numOfCols, short rowHeight, short colWidth, Boolean adornRows, Boolean adornCols, short
- rowInset, short colInset, Boolean singleSelection);
- /* single cell selection? */
-
-
- /* Initialize the gridview. If numOfRows or numOfCols is non-zero then the gridview is
- initialized to the specified size using rowHeight and colWidth if the sizedeterminer
- is sizeVariable. If either adorn is kDontAdorn, then that adorn will not
- be called. */
-
- virtual pascal void IRes(TDocument *itsDocument, TView *itsSuperView, Ptr *itsParams);
- /* Initialize the view template. */
-
- virtual pascal void WRes(ViewRsrcHandle theResource, Ptr *itsParams);
- /* Write this object out as a view resource. */
-
- virtual pascal void WriteRes(ViewRsrcHandle theResource, Ptr *itsParams);
- /* Set up the type and signature of this object and call WRes. */
-
- virtual pascal void Free(void);
- /* Free the TGridView object */
-
- /* Methods to OVERRIDE */
-
- /* Inherited Methods (OVERRIDE) */
-
- virtual pascal void CalcMinSize(VPoint *minSize);
- /* Sets the extent of the view. */
-
- virtual pascal void DoHighlightSelection(HLState fromHL, HLState toHL);
- /* Do highlighting */
-
- virtual pascal TCommand *DoMouseCommand(Point *theMouse, EventInfo *info, Point *hysteresis);
- /* Handle mouse commands */
-
- virtual pascal void Draw(Rect *area);
- /* Calls DrawRangeOfCells and AdornRow/Col as appropriate. */
-
- /* UGridView Methods to OVERRIDE */
-
- virtual pascal void AdornCol(short aCol, Rect *area);
- /* If fAdornCol is TRUE, this method is called to draw the column adornments. */
-
- virtual pascal void AdornRow(short aRow, Rect *area);
- /* If fAdornRow is TRUE, this method is called to draw the row adornments. */
-
- virtual pascal Boolean CanSelectCell(Point aCell);
-
- /* This method checks to see if a cell can be seleced. By default, this method always
- returns TRUE. */
-
- virtual pascal void HighlightCells(RgnHandle theCells, HLState fromHL, HLState toHL);
- /* Highlights the cells in theCells according to the given highlight state. */
-
- virtual pascal void DrawRangeOfCells(Point startCell, Point stopCell, Rect *aQDRect);
- /* This method calls DrawCell for each cell in need of re-drawing. */
-
- virtual pascal void DrawCell(Point aCell, Rect *aQDRect);
- /* This method draws each individual cell. IT MUST BE OVERRIDDEN! */
-
- /* General UGridView Methods */
-
- virtual pascal void AllCellsDo(pascal void (*DoToCell)(Point aCell, void *DoToCell_StaticLink),
- void *DoToCell_StaticLink);
- /* For every cell in the view perform "DoToCell". */
-
- virtual pascal void CellToVRect(Point aCell, VRect *aRect);
-
- /* Get the rectangle bounding a given cell. This includes the row and column insets. */
-
- virtual pascal void ColToVRect(short aCol, short numOfCols, VRect *aRect);
-
- /* Get the rectangle bounding the given columns. This includes the cells in the row or
- column and the row or column insets. */
-
- virtual pascal void RowToVRect(short aRow, short numOfRows, VRect *aRect);
- /* Get the rectangle bounding the given rows. This includes the cells in the row or
- column and the row or column insets. */
-
- virtual pascal void CellsToPixels(RgnHandle theCells, RgnHandle thePixels);
- /* Returns in thePixels a region that contains all of the cells in theCells. */
-
- virtual pascal void DelColAt(short aCol, short numOfCols);
- /* Delete the specified columns, starting at 'aCol' with the number to be deleted
- 'numOfCols'.This causes a redraw of only the necessary cells. */
-
- virtual pascal void DelRowAt(short aRow, short numOfRows);
- /* Delete the specified rows, starting at 'aRow' with the number of to be deleted
- 'numOfRows'.This causes a redraw of only the necessary cells. */
-
- virtual pascal void DelColFirst(short numOfCols);
-
- /* Delete the specified number of columns from the beginning of the list.This causes a
- redraw of only the necessary cells. */
-
- virtual pascal void DelRowFirst(short numOfRows);
- /* Delete the specified number of rows from the beginning of the list.This causes a
- redraw of only the necessary cells. */
-
- virtual pascal void DelColLast(short numOfCols);
-
- /* Delete the specified number of columns from the last cell of the list.This causes a
- redraw of only the necessary cells. */
-
- virtual pascal void DelRowLast(short numOfRows);
- /* Delete the specified number of rows from the last cell of the list.This causes a
- redraw of only the necessary cells. */
-
- virtual pascal void EachCellDo(Point startCell, Point stopCell, pascal void (*DoToCell)(Point
- aCell, void *DoToCell_StaticLink), void *DoToCell_StaticLink);
- /* For each cell in the rectangle defined by startCell and stopCell perform
- "DoToCell". */
-
- virtual pascal void EachSelectedCellDo(pascal void (*DoToCell)(Point aCell, void *
- DoToCell_StaticLink), void *DoToCell_StaticLink);
- /* For each cell in the selected region perform "DoToCell". */
-
- virtual pascal void EachInRgn(RgnHandle aRgn, pascal void (*DoToCell)(Point aCell, void *
- DoToCell_StaticLink), void *DoToCell_StaticLink);
- /* For each cell in the specified region perform "DoToCell". */
-
- virtual pascal Point FirstSelectedCell(void);
- /* Returns the top left cell in the selection range, if any */
-
- virtual pascal short GetColWidth(short aCol);
- /* Return the width for the specified column. */
-
- virtual pascal short GetRowHeight(short aRow);
- /* Return the height for the specified row . */
-
- virtual pascal GridViewPart IdentifyPoint(Point theQDPoint, short *aRow, short *aCol);
- /* Return the GridViewPart (inCell, inColumn, inRow, inVertex)
- in which the specified point lies. The "vertex" is the area
- where a row and column meet. */
-
- virtual pascal void InsColBefore(short aCol, short numOfCols, short aWidth);
-
- /* Insert the specified columns before the column given.The widths of the columns are
- all set to the specified aWidth. */
-
- virtual pascal void InsRowBefore(short aRow, short numOfRows, short aHeight);
-
- /* Insert the specified rows before the row given.The heights of the rows are all set
- to the specified aHeight. */
-
- virtual pascal void InsColFirst(short numOfCols, short aWidth);
- /* Insert the specified number of columns at the beginning of the list.The widths of
- the columns are all set to the specified aWidth. */
-
- virtual pascal void InsRowFirst(short numOfRows, short aHeight);
-
- /* Insert the specified number of rows at the beginning of the list.The heights of the
- rows are all set to the specified aHeight. */
-
- virtual pascal void InsColLast(short numOfCols, short aWidth);
- /* Insert the specified number columns at the end of the list.The widths of the
- columns are all set to the specified aWidth. */
-
- virtual pascal void InsRowLast(short numOfRows, short aHeight);
-
- /* Insert the specified number of rows at the end of the list.The heights of the rows
- are all set to the specified aHeight. */
-
- virtual pascal void InvalidateCell(Point aCell);
- /* Cause a cell to be marked invalid (in need of re-drawing). */
-
- virtual pascal void InvalidateSelection(void);
- /* Cause the rectangle bounding the selections to be marked
- invalid (in need of re-drawing). */
-
- virtual pascal Boolean IsCellSelected(Point aCell);
- /* Check if the specified cell is currently selected. */
-
- virtual pascal Point LastSelectedCell(void);
- /* Returns the bottom right cell in the selection range, if any */
-
- virtual pascal void ScrollSelectionIntoView(Boolean redraw);
- /* Scroll the specified rectangle into view. */
-
- virtual pascal void SetColWidth(short aCol, short numOfCols, short aWidth);
- /* Set the width of the specified columns to that given. */
-
- virtual pascal void SetRowHeight(short aRow, short numOfRows, short aHeight);
- /* Set the height of the specified rows to that given. */
-
- virtual pascal void SelectCell(Point theCell, Boolean extendSelection, Boolean highlight,
- Boolean select);
- /* Set the current selection to the specified cell. Sets up a region and then calls
- SetSelection. */
-
- virtual pascal void SetEmptySelection(Boolean highlight);
- /* Set the current selection to be empty or nothing. If highlight is kHighlight then
- the appropriate highlighting is performed. */
-
- virtual pascal void SetSelection(RgnHandle cellsToSelect, Boolean extendSelection, Boolean
- highlight, Boolean select);
- /* Set the current selections to the specified region. If extend is kExtend then
- cellsToSelect is "added" to that already selected, if highlight is kHighlight then
- cellsToSelect is highlighted as well. IF select is kSelect then cellsToSelect is
- selected, if kDeSelect then de-selected*/
-
- virtual pascal void SetSelectionRect(short left, short top, short right, short bottom, Boolean
- extendSelection, Boolean highlight, Boolean select);
- /* Set the current selections to the specified rectangle. and call SetSelection. */
-
- virtual pascal void SetSingleSelection(Boolean theSetting);
- /* If TRUE then only one item/cell can be selected at a time */
-
- virtual pascal Point VPointToCell(VPoint *aPoint);
- /* Determine the cell in which a given point lies, or (0, 0) if the given point
- doesn't lie within any cell. */
-
- virtual pascal Point VPointToLastCell(VPoint *aPoint);
-
- /* Returns the cell in which the given point lies, or the last cell of the row/column
- if the horizontal/vertical coordinate lies beyond the last cell of the row/column.*/
-
- /* Debugging Methods */
-
- virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short
- fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
- /* Used by the Inspector and the Debugger to display the contents of this class's
- fields. */
-
- };
-
- class TTextGridView : public TGridView {
- public: /* A sub-class of TGridView that can handle
- the display of text in its cells. */
- TextStyle fTextStyle; /* The text style (color, size, etc. ) */
- short fLineHeight; /* height of each item including leading */
- short fLineAscent;
- /* pos. of baseline relative to top of line */
-
- /* Initialization and Free Methods */
-
- virtual pascal void ITextGridView(TDocument *itsDocument, TView *itsSuperView, VPoint *
- itsLocation, VPoint *itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, short
- numOfRows, short numOfCols, short rowHeight, short colWidth, Boolean adornRows, Boolean
- adornCols, short rowInset, short colInset, Boolean singleSelection, TextStyle *itsTextStyle);
- /* size, color, etc.
- font info */
-
- /* Initialize the TextGridView. If numOfRows or numOfCols is non-zero then the
- gridview is initialized to the specified size. The row and height of the cells is
- determine by the font size, style etc. The default size may be changed with calls
- to the the SetRowHeight and SetColWidth methods. If either adorn is kDontAdorn,
-
- then that adorn will not be called. The "Insets" allow space between cells and may
- be used to draw row and column adornments. */
-
- virtual pascal void IRes(TDocument *itsDocument, TView *itsSuperView, Ptr *itsParams);
- /* Initialize the view template. */
-
- virtual pascal void WRes(ViewRsrcHandle theResource, Ptr *itsParams);
- /* Write this object out as a view resource. */
-
- virtual pascal void WriteRes(ViewRsrcHandle theResource, Ptr *itsParams);
- /* Set up the type and signature of this object and call WRes. */
-
- /* Methods To OVERRIDE */
-
- virtual pascal void GetText(Point aCell, StringPtr aString);
- /* This routine gets the text to be draw in a given cell. IT MUST BE OVERRIDDEN! */
-
- /* General Methods */
-
- virtual pascal void DrawCell(Point aCell, Rect *aQDRect);
- /* Calls GetText and then draws the text */
-
- virtual pascal Boolean Focus(void);
- /* Calls inherited focus and calls SetUpFont */
-
- virtual pascal void SetUpFont(void);
- /* Sets up the font for this view. */
-
- virtual pascal void SetPen(void);
- /* Sets the font characteristics of the current port. Called at the beginning of the
- Draw method.*/
-
- virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short
- fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
- /* Used by the Inspector and the Debugger to display the contents of this class's
- fields. */
-
- };
-
- class TTextListView : public TTextGridView {
- public: /* This subclass of TTextGridView handles
- lists in a manner similar to the List
- Manager in the toolbox. These lists
- typically consist of single columns and
- the case of this subclass handle the
- placeme { Initialization and Free Methods
- */
-
- virtual pascal void ITextListView(TDocument *itsDocument, TView *itsSuperView, VPoint *
- itsLocation, VPoint *itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, short
- numOfItems, short rowHeight, short colWidth, Boolean adornRows, Boolean adornCols, short
- rowInset, short colInset, Boolean singleSelection, TextStyle *itsTextStyle);
-
- /* Initialize the TextListView. If numOfItems is non-zero then the listview is
- initialized to the specified size. The width and height of the items are determined
- by the font size, style etc. The default size may be changed with calls to the the
- SetItemHeight and SetItemWidth methods. The "Insets" allow space between items. */
-
- virtual pascal void WriteRes(ViewRsrcHandle theResource, Ptr *itsParams);
- /* Set up the type and signature of this object and call WRes. */
-
- /* Methods To OVERRIDE */
-
- virtual pascal void GetItemText(short anItem, StringPtr aString);
- /* Get the text to be drawn for a given item. THIS METHOD MUST BE OVERRIDDEN !! */
-
- virtual pascal Boolean CanSelectItem(short anItem);
- /* Determine if the item is selectable */
-
- /* General Methods */
- virtual pascal void AllItemsDo(pascal void (*DoToItem)(short anItem, void *DoToItem_StaticLink)
- , void *DoToItem_StaticLink);
- /* For all the items in the view perform "DoToItem". */
-
- virtual pascal Boolean CanSelectCell(Point aCell);
- /* This method checks to see if a cell can be selected. This method simply calls
- CanSelectItem */
-
- virtual pascal void DelItemAt(short anItem, short numOfItems);
- /* Delete the specified items. This causes a redraw of only the necessary cells. */
-
- virtual pascal void DelItemFirst(short numOfItems);
- /* Delete the specified items. This causes a redraw of only the necessary cells. */
-
- virtual pascal void DelItemLast(short numOfItems);
- /* Delete the specified items. This causes a redraw of only the necessary cells. */
-
- virtual pascal void EachItemDo(short start, short stop, pascal void (*DoToItem)(short anItem,
- void *DoToItem_StaticLink), void *DoToItem_StaticLink);
- /* For each item in the specified range perform "DoToItem". */
-
- virtual pascal void EachSelectedItemDo(pascal void (*DoToItem)(short anItem, void *
- DoToItem_StaticLink), void *DoToItem_StaticLink);
- /* For each item selected perform "DoToItem". */
-
- virtual pascal short GetItemHeight(short anItem);
- /* Return the height of the specified item. */
-
- virtual pascal short GetItemWidth(void);
- /* Return the width of the view. */
-
- virtual pascal void GetText(Point aCell, StringPtr aString);
- /* Calls GetItemText with an item number. */
-
- virtual pascal void InsItemBefore(short anItem, short numOfItems);
- /* Insert numOfItems before anItem in the list. */
-
- virtual pascal void InsItemFirst(short numOfItems);
- /* Insert numOfItems at the beginning of the list. */
-
- virtual pascal void InsItemLast(short numOfItems);
- /* Insert numOfItems at the end of the list. */
-
- virtual pascal Boolean IsItemSelected(short anItem);
- /* Check if the specified item is currently selected. */
-
- virtual pascal void Resize(VCoordinate width, VCoordinate height, Boolean invalidate);
- /* Resize the view. */
-
- virtual pascal void SelectCell(Point theCell, Boolean extendSelection, Boolean highlight,
- Boolean select);
- /* Calls SelectItem with the appropriate item number */
-
- virtual pascal void SelectItem(short anItem, Boolean extendSelection, Boolean highlight, Boolean
- select);
- /* Select the given item. If extend is true then the item is added to the current
- selection. Otherwise the current selection is deselected. If highlight is true then
- the selected item is highlighted.*/
-
- virtual pascal void SetItemHeight(short anItem, short numOfItems, short aHeight);
- /* Set the height of an item to be different from the default. This
- changes the height of only the specified items. */
-
- virtual pascal void SetItemWidth(short aWidth);
- /* Set the width of the view to aWidth. (This changes the width of all
- the items. */
-
- virtual pascal short FirstSelectedItem(void);
- /* Returns the first item selected. */
-
- virtual pascal short LastSelectedItem(void);
- /* Returns the last item selected. */
-
- virtual pascal void InvalidateItem(short anItem);
- /* Invalidates the given item, causing it to be redrawn */
-
- virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short
- fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
- /* Used by the Inspector and the Debugger to display the contents of this class's
- fields. */
-
- };
-
- class TCellSelectCommand : public TCommand {
- public:
- TGridView *fGridView; /* The associated GridView */
- Boolean fShiftKey; /* Shift Key down? */
- Boolean fCmdKey; /* Command Key down? */
- Boolean fDeselecting;
- Point fAnchorCell;
- Point fPrevCell;
- RgnHandle fThisSelection;
- RgnHandle fPrevSelection;
- RgnHandle fDifference;
-
- virtual pascal void ICellSelectCommand(TGridView *itsView, Boolean theShiftKey, Boolean
- theCmdKey);
- /* Initialize the command object. */
-
- virtual pascal void Free(void);
- /* If the region fPrevSelection and fDifference are not NIL then dispose of them
- before calling inherited Free. */
-
- virtual pascal void TrackFeedback(VPoint *anchorPoint, VPoint *nextPoint, Boolean turnItOn,
- Boolean mouseDidMove);
- /* Override this method to give feedback while the mouse button is down. The default
- does nothing. */
-
- virtual pascal TCommand *TrackMouse(TrackPhase aTrackPhase, VPoint *anchorPoint, VPoint *
- previousPoint, VPoint *nextPoint, Boolean mouseDidMove);
- /* Track the mouse when the button is down. */
-
- virtual pascal void DoIt(void);
- /* The method that will do the actual task to be performed by the command. MUST BE
- OVERRIDDEN. */
-
- virtual pascal void ComputeAnchorCell(Point *clickedCell);
- /* Computes the cell that the mouse is first clicked in when making a selection. */
-
- virtual pascal void ComputeNewSelection(Point *clickedCell);
- /* Calculate what the new selection should be. */
-
- virtual pascal void HighlightNewSelection(void);
- /* Highlight the new selection. */
-
- virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short
- fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
- /* Used by the Inspector and the Debugger to display the contents of this class's
- fields. */
-
- };
-
- class TRCSelectCommand : public TCellSelectCommand {
- public:
- /* An abstract superclass for row and column selection */
-
- virtual pascal void ComputeNewSelection(Point *clickedCell);
- /* Computes the new selection. */
-
- virtual pascal TCommand *TrackMouse(TrackPhase aTrackPhase, VPoint *anchorPoint, VPoint *
- previousPoint, VPoint *nextPoint, Boolean mouseDidMove);
- /* Track the mouse during selection. */
-
- virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short
- fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
- /* Used by the Inspector and the Debugger to display the contents of this class's
- fields. */
-
- };
-
- class TRowSelectCommand : public TRCSelectCommand {
- public:
- /* A subclass that performs selections on
- rows. */
- virtual pascal void IRowSelectCommand(TGridView *itsView, Boolean theShiftKey, Boolean theCmdKey
- );
- /* Initialization of command. */
-
- virtual pascal void ComputeAnchorCell(Point *clickedCell);
- /* Override of method to perform computations specific to row selection. */
-
- virtual pascal void ComputeNewSelection(Point *clickedCell);
- /* Override of method to perfom computation of new selection specific to row
- selection. */
- virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short
- fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
- /* Used by the Inspector and the Debugger to display the contents of this class's
- fields. */
-
- };
-
- class TColumnSelectCommand : public TRCSelectCommand {
- public:
- /* A subclass that handles the selection
- of columns in a GridView. */
- virtual pascal void IColumnSelectCommand(TGridView *itsView, Boolean theShiftKey, Boolean
- theCmdKey);
- /* Initialization method. */
-
- virtual pascal void ComputeAnchorCell(Point *clickedCell);
- /* Override of method to perform computations specific to column selection. */
-
- virtual pascal void ComputeNewSelection(Point *clickedCell);
- /* Override of method to perform computation of new selection specific to column
- selection. */
-
- virtual pascal void Fields(pascal void (*DoToField)(StringPtr fieldName, Ptr fieldAddr, short
- fieldType, void *DoToField_StaticLink), void *DoToField_StaticLink);
- /* Used by the Inspector and the Debugger to display the contents of this class's
- fields. */
-
- };
- /* These are intended to be private, but are in the interface so that you can use these
- regions if you override the methods that use them. */
-
- extern pascal RgnHandle pPixelsToHighlight; /* Used by HighlightCells */
- extern pascal RgnHandle pPreviousSelection; /* Used by SetSelection */
- extern pascal RgnHandle pDifference; /* Used by SetSelection */
- extern pascal RgnHandle pVisibleCells; /* Used by CellsToPixels */
- extern pascal RgnHandle pInvalidateRgn; /* Used by InvalidateSelection */
-
- extern pascal void InitUGridView(void);
- /* Creates all the regions used by the GridView class and then sets the global flag
- 'gUGridViewInitialized'. */
-
- #endif
-
-